home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / basic / ace_final.lha / ACE_GPL_Release / utils / NAP / NAP.doc < prev    next >
Encoding:
Text File  |  1996-08-29  |  16.2 KB  |  366 lines

  1.  
  2.  
  3.  |\   |       |¯¯¯¯|       |¯¯¯¯|                        Version 2.00
  4.  | \  |       |____|       |____|                         08-18-1996
  5.  |  \ |       |    |       |                                Beta-3
  6.  |   \| e w   |    | C E   |     r e p r o c e s s o r
  7.  
  8.  
  9.  
  10.  
  11.  I N T R O D U C T I O N
  12.  
  13.  As you can recognize  by reading the name of the program,  NAP  is a
  14.  new preprocessor for the programming language ACE.
  15.  
  16.  Until now APP or a C preprocessor (mostly CPP)  was used by users of
  17.  ACE. Both have had advantages and disadvantages. Whereas APP doesn't
  18.  recognize defines but removes ACE comments, CPP does process defines
  19.  but can only remove C-structures.
  20.  
  21.  NAP has been created to combine the features of APP and CPP. Lots of
  22.  features are not included yet,  but the features already implemented
  23.  should satisfy many wishes.
  24.  
  25.  
  26.  B A C K G R O U N D
  27.  
  28.  In February of 1996 I worked for the 1st time with includes. I don't
  29.  know anymore what I wanted to do. But at least I needed some certain
  30.  structures and used therefore an include command to get these struc-
  31.  tures.
  32.  But to my big surprise  I'd to notice that there have also been many
  33.  structures added I didn't need.  Therefore I thought why not writing
  34.  a program  that does remove these unused structures  and furthermore
  35.  ACE comments and those stupid comments left by CPP.  The idea was to
  36.  run this program, so called RemoveStuff,  after the preprocessor and
  37.  to filter its output again.  I even thought of expanding RemoveStuff
  38.  to a real preprocessor in the future.
  39.  But I got rid of this idea because I was uncertain about some facts.
  40.  Then Herbert Breuer wrote me due to RemoveStuff and asked whether it
  41.  would be possible to make RemoveStuff a  self-standing preprocessor.
  42.  Some  e-mails  later I started my work.  The  1.x versions have been
  43.  running quite satisfying but they were very slow.  Furthermore, only
  44.  the preprocessor command INCLUDE has been processed.
  45.  
  46.  But now  we are already at  version 2.00.  This version is the third
  47.  "official" beta release of this version.
  48.  
  49.  
  50.  S P E E D
  51.  
  52.  Whereas the 1st beta release has been about 100 per cents faster  at
  53.  the time of  release  than the first working version  (which has not
  54.  been released),  the 2nd beta release is even  200 per cents  faster
  55.  than the 1st one.
  56.  
  57.  For testing purposes I am using a short program called NAPtest.b. To
  58.  process this program CPP needs 15 seconds. At the time when I'm wri-
  59.  ting this manual, NAP needs 26 seconds.
  60.  The following is a table about speeding increase I could get NAP to.
  61.  But these numbers have to be seen with reservation.  On the one hand
  62.  they can differ  ± 1 seconds.  Furthermore they are only valid on an
  63.  Amiga 500 with KS 1.3 and one mega byte RAM.  On the other hand  all
  64.  include files had to be loaded from disc making NAP even slower.
  65.  Theoretically  NAP  could be on modern Amigas nearly as fast as  CPP
  66.  due to faster loading.  But anyway.  On new  Amigas  NAP  should  be
  67.  faster anyway. If it is fast enough that the difference to the speed
  68.  of CPP can be neglected must be shown.
  69.  
  70.  +---------+-----------+-------+-------------------+----------------+
  71.  | version |   date    | time  | run without opts  | run with -sqe  |
  72.  +---------+-----------+-------+-------------------+----------------+
  73.  |         | 06-26-'96 | 14:20 |    194 seconds    |     unknown    |
  74.  |         | 06-27-'96 | 13:20 |    162 seconds    |     unknown    |
  75.  |         | 06-28-'96 | 14:30 |    151 seconds    |     unknown    |
  76.  |         | 06-29-'96 | 12:35 |    130 seconds    |     unknown    |
  77.  |         |           | 19:55 |    115 seconds    |     unknown    |
  78.  |         | 07-01-'96 | 15:30 |    100 seconds    |     unknown    |
  79.  |         |           | 20:40 |     87 seconds    |   92 seconds   |
  80.  |  2-00b  | 07-12-'96 | 12:30 |     88 seconds    |   88 seconds   |
  81.  +---------+-----------+-------+-------------------+----------------+
  82.  |         | 07-17-'96 | 23:45 |     33 seconds    |   31 seconds   |
  83.  |         | 07-19-'96 | 11:30 |     31 seconds    |   28 seconds   |
  84.  |  2-00b2 | 07-23-'96 | 20:00 |     26 seconds    |   22 seconds   |
  85.  +---------+-----------+-------+-------------------+----------------+
  86.  
  87.  These increases could be achieved  by replacing certain ACE routines
  88.  by faster assembler routines and by optimising the source code. Some
  89.  parts of the routines have even been totally rewritten.
  90.  The big destination by me is to get  NAP  to do everything  CPP does
  91.  and to do this with nearly the same speed. Therefore this version is
  92.  in a kind of midfield.
  93.  
  94.  
  95.  R E S T R I C T I O N S
  96.  
  97.  Since many changements came to NAP since version 1.1, there are some
  98.  things not working such as wanted.  This doesn't mean that there are
  99.  bugs in NAP, I'd like to call them nasty side-effects. But of course
  100.  there might also be bugs (see section "Known Bugs").  Therefore this
  101.  is a beta release.
  102.  
  103.  - #include
  104.  
  105.    * When NAP finds such a command it tries to include the file if it
  106.      has not been included yet. Within this file another #include can
  107.      be and so on.
  108.      ACE supports file openings for 9 files at the same time.  There-
  109.      fore NAP is unable to open more than 9 files a time. One file is
  110.      always open, this is the output file.
  111.      Until now  I never had more than seven files open.  But if there
  112.      are case where more than 9 files must be opened I already have a
  113.      plan how to realize this.
  114.  
  115.  - #define
  116.  
  117.    * Defines are always case-sensitiv. Since this is also the case by
  118.      CPP I suppose this is standard.
  119.  
  120.  - Comments
  121.  
  122.    * Block comments must not be nested! This shouldn't happen anyway.
  123.      But it could happen that someone uses { } within such a comment,
  124.      to demonstrate something  (so happend within the source code  of
  125.      NAP v1.1  where I wanted to say within a block comment  that the
  126.      following sub program replaces all C comments through { } !!)
  127.  
  128.  - in general
  129.  
  130.    * Tabulators are forbidden!  They mark  (as all ASCII codes <= 10)
  131.      the end of a line.  And tab has the ASCII code 9.  In future re-
  132.      leases this restriction will probably been removed.
  133.  
  134.  
  135.  U S A G E
  136.  
  137.  NAP can only be launched from the CLI. It needs a minimum of two op-
  138.  tions :  the input and  the output file.  But there can also further
  139.  parameters be passed, which activate or deactivate certain actions.
  140.  
  141.  Usage: NAP [-option [-option [-...]]] <inputfile> <outputfile>
  142.  
  143.  Options consist of one letter.  If more than one option is used they
  144.  can be clued together. Exceptions are options which need an additio-
  145.  nal parameter.  This parameter must be put directly  without  spaces
  146.  behind the option letter. Behind the parameter there must be a space
  147.  thus leading to a new parameter field of NAP.
  148.  
  149.  Now all options are explained.  Most of them are so-called switches.
  150.  They activate or deactive features of NAP.
  151.  
  152.  - Option S
  153.    Switches the removement of unused structures off.
  154.  
  155.  - Option C
  156.    Switches the removement of comments off.
  157.  
  158.  - Option Q
  159.    Defines are not replaced within the source code  but defined via a
  160.    CONST statement (exception: within structures)
  161.  
  162.  - Option I
  163.    Defines are just ignored.
  164.  
  165.  - Option E
  166.    Error and warning messages are suppressed.
  167.  
  168.  - Option B<buffersize>
  169.    Sets file buffer to <buffersize>*1000 bytes.
  170.  
  171.  - Option H
  172.    Prints the usage message.
  173.  
  174.  - Option D<token>[=<replacement>]
  175.    Defines  <token>  as if  "#define <token> <replacement>"  has been
  176.    found within the source code. If <replacement> is not submitted, a
  177.    1 will be used.
  178.  
  179.  - Option U<token>
  180.    Undefines <token> as if you wrote "#undef <token>".
  181.  
  182.  - Option P<directory>
  183.    Adds a new  path to the  path list  to be gone through for include
  184.    files.  You can define 7 new paths.  The current directory and the
  185.    logical device ACEINCLUDE: are always defined! Pay attention that
  186.    <directory> must end with : or /
  187.  
  188.  
  189.  F E A T U R E S
  190.  
  191.  NAP does many things.  Some can be de-/activated.  It follows a des-
  192.  cription of NAP's work when no options are used (default).
  193.  At first  NAP  checks  whether the input  and the output file can be
  194.  opened. It the output file already exists it will be deleted without
  195.  warning  (sorry).  This could change in future releases.  Afterwards
  196.  NAP goes through the contents of the input file  and copies it  line
  197.  by line to the output file.  During this work all C comments are re-
  198.  placed by ACE comments.  Furthermore the comments are removed.  Same
  199.  for structures which aren't used within this programme.
  200.  By processing the input file  NAP also tries to summarize bunches of
  201.  empty lines  (but they must be REAL empty lines).  Furthermore  each
  202.  line (except comments !) are checked of the use of defines. If a de-
  203.  fine is found it will be replaced.  Eventually passed parameters are
  204.  put in.
  205.  
  206.  
  207.  H I N T S  . . .
  208.  
  209.  ... to defines:
  210.  
  211.   Defines are declared via:      #define <token> <replacement>
  212.   NAP supposed that  there  are  no  spaces  within  <token>.  Within
  213.   <replacement> may be spaces. It is even possible to split <replace-
  214.   ment> in different lines.  To be precisely, NAP joins the following
  215.   line to the current one (but only within defines), it the last let-
  216.   ter is a \ or a ~.
  217.  
  218.  ... to #if and #elif statements
  219.  
  220.   Although I suppose it to be against the  ANSI-C standard  I added a
  221.   = for <expression>. If the result of the left side is equal the re-
  222.   sult of the right side, a 1 will be given back,  otherwise a 0.  In
  223.   front and after the = you have to put a space.
  224.   Otherwise NAP checks, whether <expression> is true ( <>0 ) or false
  225.   (=0).  At the moment you can use +, -, *, \ and /.  You are allowed
  226.   to use parantheses,  but  they must not be nested.  Principally all
  227.   numbers within  <expression>  are considered to be decimal.  If you
  228.   wish to use hexadecimal or octal numbers you must use the ACE-typi-
  229.   cal predecessors!
  230.   The result of <expression> is always SINGLE!  Therefore the  result
  231.   can be vary a little bit.
  232.  
  233.  
  234.  
  235.  K N O W N  B U G S
  236.  
  237.  * NAP seems to interprete some special letters like © as markings of
  238.    the end of line. I really don't know why! (REALLY!!!)
  239.  * Since  NAP  defines unused structures as structures  which are not
  240.    declared and which are not used within a structure that is declar-
  241.    ed,  it might be possible  that it removes structures even if they
  242.    are needed!  This may happen  when this structure is only affected
  243.    by a SIZEOF command but not declared,  neither  directly nor indi-
  244.    rectly.
  245.    This error should not occur very often.
  246.  
  247.  If you find more bugs please tell me (see section "Copyright").
  248.  
  249.  
  250.  F U T U R E  R E L E A S E S
  251.  
  252.  NAP is not complete yet.  Many things could be added,  some probably
  253.  already in the next versions.
  254.  
  255.   - speed increasing
  256.   - joining of lines even without #define
  257.   - implementing of more preprocessor commands (#ASSERT, #PRAGMA ...)
  258.   - using of tabs within the input file
  259.   - more options  (by reading the manual of CPP  I see lots of things
  260.     NAP is missing)
  261.   - (your ideas ...)
  262.  
  263.  
  264.  C O P Y R I G H T
  265.  
  266.  NAP is  Cardware.  This does just mean  that I do not want money for
  267.  NAP  (but I would also not reject it!!!),  but that  I  am satisfied
  268.  with a picture postcard or a letter  where the user tells  that s/he
  269.  uses NAP and how s/he likes it.
  270.  This makes sense (in my eyes).  At first I get to know how many peo-
  271.  ple uses NAP,  how far it is spread  and how the people think  about
  272.  it.  Second I get some nice stamps ;)   So, if anybody  really  does
  273.  what he is supposed to do, s/he could perhaps use some nicer stamps.
  274.  Who does not want to use snail mail can also send an EMail.  This is
  275.  for people  who want to say a lot or where there will follow a long-
  276.  er correspondence.  Furthermore I would prefer EMail from German and
  277.  East-European users since I have enough stamps from these countries.
  278.  If they don't have EMail access they could send a postcard anyway.
  279.  I am putting NAP to cardware  since, on the one hand, I wouldn't get
  280.  money for it when making it shareware but, on the other hand, I just
  281.  want to get something for  my  hard work  (and  sending  a  postcard
  282.  should not be  too expensive  in any country that  the  user  cannot
  283.  afford it. So come on!)
  284.  
  285.  Otherwise NAP is the full property of the author and programmer. Ev-
  286.  ery changement is strictly forbidden  and breaks international copy-
  287.  right laws.  Parts of NAP's source, especially routines like Search2
  288.  from the file NAP_Mods.b,  can be used in your own programs  as long
  289.  as all  changes are made recognizable  as well as the fact that  the
  290.  copyright for these routines are still by the author of NAP. If any-
  291.  one earns money with programs containing  NAP  routines  the written
  292.  permission of the author is necessary.  If not,  it is enough to in-
  293.  form the author.
  294.  It is also forbidden  to earn money  with  NAP.  This means that the
  295.  selling of NAP is prohibited  if more than 2 US-$ or the same in any
  296.  other currency is to pay for.
  297.  But you are allowed to copy and  spread  NAP  freely  as long as all
  298.  files stay unaltered.
  299.  
  300.  There is no warranty for NAP,  therefore no liability of the author.
  301.  With the first use of  NAP  you  do  made clear  that you agree with
  302.  using NAP completely on your own risk.
  303.  
  304.  
  305.  C R E D I T S
  306.  
  307.  A big Thank You goes at first to my  Amiga 500  which stayed with me
  308.  many years loyally.  And  he is going to do this probably some years
  309.  more.
  310.  Also many thanks go to  Herbert Breuer  who encouraged me  since the
  311.  beginning of  NAP  (in fact I would have never  started  programming
  312.  NAP without him) and who stand by me with advices and hints.
  313.  Furthermore,  thanks to David Benn,  author of ACE,  who did help me
  314.  often when I had had problems.
  315.  Last, but not least,  thanks to all the people  who are using or who
  316.  are going to use NAP and who are showing understanding  for eventual
  317.  bugs.
  318.  
  319.  
  320.  C O N T A C T I N G  T H E  A U T H O R  A N D  A B O U T  H I M
  321.  
  322.  Well,  the author of NAP am I ;)  My name is Daniel Seifert and I am
  323.  living in Berlin-Hellersdorf  (Hellersdorf is the eastmost suburb of
  324.  Berlin). This is also the place where I go to school, in fact to the
  325.  1st Gymnasium (= grammar school !) Hellersdorf.  I am in the twelfth
  326.  grade.
  327.  If anybody want to talk with me, due to NAP (see also section "Copy-
  328.  right"), due to one of my other programs or due to something else  I
  329.  will take me time to answer  him/her.  But I am not willed to  spend
  330.  money for this! So, if anyone want to talk s/he should use EMail. My
  331.  account is at my school. Therefore there might be some delays due to
  332.  important exams or due to holidays. If anyone doesn't have the chan-
  333.  ce to use EMail  I do also write via "snail" mail.  But the post fee
  334.  should be send to me before,  since I not very often suppose mail so
  335.  important that I want to spend money for.  So  if you do not send me
  336.  the postage, it will surely happen that you do not get an answer.
  337.  Otherwise I would really like talking to you.
  338.  
  339.  (Postage in Germany for a 20g letter : within the European Community
  340.  1 DM,  to other countries 2 DM or 3 DM for air mail.  If you want to
  341.  swap more than one letter, send a little bit more money for the next
  342.  letters.  If the money is  not enough  I do just send the  letter as
  343.  "Recipients pay", but I do not know whether this will work.)
  344.  
  345.  +---------------------------------------------------------------------+
  346.  | Daniel Seifert            //tm   Tel: (+49) 030 / 9984711           |
  347.  | Weißenfelser Str. 40     //    EMail: dseifert@hell1og.be.schule.de |
  348.  | 12627 Berlin         \\ //                           +--------------+
  349.  | GERMANY               \X/ The Amiga lives ...        |/\_    _/\_   |
  350.  +------------------------------------------------------+\/\~~~~/\/\~~~|
  351.  | PGP finger print : A8B0282C985102066C8769391CF146AB  |/\/\~~/\/\/\~~|
  352.  | Public key (6D99EA5D) available on request/keyserver |\/\/\/\/\/\/\/|
  353.  +------------------------------------------------------+--------------+
  354.  
  355.  From October '96 :
  356.  
  357.  +-------------------------------------------------------------------+
  358.  | Daniel Seifert          //tm   Tel: (+49) 030 /  ? ? ?            |
  359.  | Elsenborner Weg 25     //    EMail: dseifert@hell1og.be.schule.de |
  360.  | 12621 Berlin       \\ //                             +------------+
  361.  | GERMANY             \X/ The Amiga lives ...          |   |¯\      |
  362.  +------------------------------------------------------+   |  ) _   |
  363.  | PGP finger print : A8B0282C985102066C8769391CF146AB  |   | / (_   |
  364.  | Public key (6D99EA5D) available on request/keyserver |   ¯¯  __)  |
  365.  +------------------------------------------------------+------------+
  366.